package com.wicket.okrframework.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrframework.base.service.*;
import com.wicket.okrframework.base.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.common.PostDto;
import com.wicket.okrframework.biz.service.dto.common.StationDto;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import com.wicket.okrframework.common.util.RedisUtil;
import com.wicket.okrframework.dal.po.mbg.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.wicket.okrframework.common.exception.Assert;
import cn.hutool.core.collection.CollectionUtil;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class StationServiceImpl
        implements com.wicket.okrframework.biz.service.StationService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MStationService mStationService;
    @Resource
    private MStaffingService mStaffingService;
    @Resource
    private MPositionService mPositionService;
    @Resource
    private MPostService mPostService;
    @Resource
    private MDutyTargetDetailService mDutyTargetDetailService;
    @Resource
    private MStationTypeService mStationTypeService;

    /**
   * D1-3查询岗位列表[1491]
   * gen by moon at 10/2/2022, 12:08:46 AM
   */
  @Trace(operationName = "D1-3查询岗位列表")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryStationListRespDto queryStationList(QueryStationListReqDto reqDto){
    
      
      List<Station> listStation_1 =new ArrayList<>();
//步骤0: 1-3-07查询岗位列表 - queryStationList
     List<Station> listStation =new ArrayList<>();
    QueryStationListReq queryStationListReq=new QueryStationListReq();
  if(reqDto!=null){
      queryStationListReq.setPostId(reqDto.getPostId());//SimpleFieldAssign//sourceId:47890_1
queryStationListReq.setStationTypeId(reqDto.getStationTypeId());//SimpleFieldAssign//sourceId:47891_1
queryStationListReq.setStationName(reqDto.getStationName());//SimpleFieldAssign//sourceId:39667_1
queryStationListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47892_1
queryStationListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:39672_1
queryStationListReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:49354_1
    }
  
    /*1-3-07查询岗位列表[207]   */
    
      listStation = mStationService.queryStationList(queryStationListReq);
      
      
      listStation_1 = listStation;
    
QueryStationListRespDto retData = new QueryStationListRespDto();
  retData.setStationList(listStation_1.stream().map(item -> BeanUtil.toBean(item, StationDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:39693_1
  

  
  
return retData;
  }

    /**
   * D1-3查询编制去重岗位列表 （边界）[1763]
   * gen by moon at 10/2/2022, 12:25:09 AM
   */
  @Trace(operationName = "D1-3查询编制去重岗位列表 （边界）")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryNoRepStationListRespDto queryNoRepStationList(QueryNoRepStationListReqDto reqDto){
    
      
      List<Station> listStation_1 =new ArrayList<>();
//步骤0: 1-3-15查询编制列表 - queryStaffingList
     List<Staffing> listStaffing =new ArrayList<>();
    QueryStaffingListReq queryStaffingListReq=new QueryStaffingListReq();
  queryStaffingListReq.setIsArchive("FALSE");//sourceId:53491_1
if(reqDto!=null){
      queryStaffingListReq.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:53490_1
    }
  
    /*1-3-15查询编制列表（查未去重职务）[192]   */
    Assert.isNull(queryStaffingListReq.getDeptId(),"D1-3查询编制去重岗位列表 （边界）-1-3-15查询编制列表（查未去重职务）-部门ID不能为空",false);
Assert.isNull(queryStaffingListReq.getIsArchive(),"D1-3查询编制去重岗位列表 （边界）-1-3-15查询编制列表（查未去重职务）-是否存档不能为空",false);
      listStaffing = mStaffingService.queryStaffingList(queryStaffingListReq);
      
      
      
    
//步骤1: 1-3-05批量查询职务列表 - batchQueryPositionList
     List<Position> listPosition =new ArrayList<>();
    if(listStaffing !=null&& listStaffing.size()>0 ){
          BatchQueryPositionListReq batchQueryPositionListReq=new BatchQueryPositionListReq();
  batchQueryPositionListReq.setPositionList(listStaffing.stream().map(item->item.getPositionId())
        .collect(Collectors.toList()));/*list-to-strings*///sourceId:53493_1
batchQueryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53496_1
  
    /*1-3-05批量查询职务列表[1460]   */
    Assert.isNull(batchQueryPositionListReq.getSubjectLifeCycle(),"D1-3查询编制去重岗位列表 （边界）-1-3-05批量查询职务列表-主体生命周期不能为空",false);
      listPosition = mPositionService.batchQueryPositionList(batchQueryPositionListReq);
      
      
      
           }
    
//步骤2: 1-3-07批量查询岗位列表 - batchQueryStationList
     List<Station> listStation =new ArrayList<>();
    if(listPosition !=null&& listPosition.size()>0 ){
          BatchQueryStationListReq batchQueryStationListReq=new BatchQueryStationListReq();
  batchQueryStationListReq.setStationList(listPosition.stream().map(item->item.getStationId())
        .collect(Collectors.toList()));/*list-to-strings*///sourceId:53500_1
batchQueryStationListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53501_1
  
    /*1-3-07批量查询岗位列表（最终岗位结果）[1466]   */
    Assert.isNull(batchQueryStationListReq.getSubjectLifeCycle(),"D1-3查询编制去重岗位列表 （边界）-1-3-07批量查询岗位列表（最终岗位结果）-主体生命周期不能为空",false);
      listStation = mStationService.batchQueryStationList(batchQueryStationListReq);
      
      
      listStation_1 = listStation;
           }
    
QueryNoRepStationListRespDto retData = new QueryNoRepStationListRespDto();
  retData.setStationList(listStation_1.stream().map(item -> BeanUtil.toBean(item, StationDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:53504_1
  

  
  
return retData;
  }

    /**
   * D1-3查询岗位列表(边界)[1662]
   * gen by moon at 10/2/2022, 12:18:19 AM
   */
  @Trace(operationName = "D1-3查询岗位列表(边界)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryStationListBorderRespDto queryStationListBorder(QueryStationListBorderReqDto reqDto){
    
      
      List<Station> listStation_1 =new ArrayList<>();
List<Post> listPost_1 =new ArrayList<>();
//步骤0: 1-3-07查询岗位列表 - queryStationList
     List<Station> listStation =new ArrayList<>();
    QueryStationListReq queryStationListReq=new QueryStationListReq();
  queryStationListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49324_1
queryStationListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:49356_1
if(reqDto!=null){
      queryStationListReq.setPostId(reqDto.getPostId());//SimpleFieldAssign//sourceId:49322_1
queryStationListReq.setStationTypeId(reqDto.getStationTypeId());//SimpleFieldAssign//sourceId:49323_1
queryStationListReq.setStationName(reqDto.getStationName());//SimpleFieldAssign//sourceId:49319_1
    }
  
    /*1-3-07查询岗位列表[207]   */
    Assert.isNull(queryStationListReq.getSubjectLifeCycle(),"D1-3查询岗位列表(边界)-1-3-07查询岗位列表-主体生命周期不能为空",false);
Assert.isNull(queryStationListReq.getSpaceId(),"D1-3查询岗位列表(边界)-1-3-07查询岗位列表-创建于空间ID不能为空",false);
      listStation = mStationService.queryStationList(queryStationListReq);
      
      
      listStation_1 = listStation;
    
//步骤1: 1-3-08批量查询职位列表 - batchQueryPostList
     List<Post> listPost =new ArrayList<>();
    if(listStation !=null&& listStation.size()>0 ){
          BatchQueryPostListReq batchQueryPostListReq=new BatchQueryPostListReq();
  batchQueryPostListReq.setPostList(listStation.stream().map(item->item.getPostId())
        .collect(Collectors.toList()));/*list-to-strings*///sourceId:49334_1
batchQueryPostListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49335_1
  
    /*1-3-08批量查询职位列表[1467]   */
    
      listPost = mPostService.batchQueryPostList(batchQueryPostListReq);
      
      
      listPost_1 = listPost;
           }
    
QueryStationListBorderRespDto retData = new QueryStationListBorderRespDto();
  //数据集融合  MoreListToOneSource
        if(listStation_1!= null && !CollectionUtil.isEmpty(listStation_1) ){
          for (Station station : listStation_1) {
              StationDto retElm = new StationDto();
             retElm.setStationId(station.getStationId());//SimpleFieldAssign//sourceId:24745_2
retElm.setPostId(station.getPostId());//SimpleFieldAssign//sourceId:24746_2
retElm.setStationName(station.getStationName());//SimpleFieldAssign//sourceId:24748_2
              retData.getStationList().add(retElm);
               if(listPost_1!= null){
          for (Post post : listPost_1) {
                if (post.getPostId().equals(station.getPostId())) {
                 retElm.setPostName(post.getPostName());//SimpleFieldAssign//sourceId:24747_2
                }
            }
          }
        
          }
        }//sourceId:49343_1
  

  
  
return retData;
  }

    /**
   * D1-3查询职位列表（边界）[1661]
   * gen by moon at 10/2/2022, 12:18:07 AM
   */
  @Trace(operationName = "D1-3查询职位列表（边界）")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryPostListBorderRespDto queryPostListBorder(QueryPostListBorderReqDto reqDto){
    
      
      List<Post> listPost_1 =new ArrayList<>();
//步骤0: 1-3-08查询职位列表 - queryPostList
     List<Post> listPost =new ArrayList<>();
    QueryPostListReq queryPostListReq=new QueryPostListReq();
  if(reqDto!=null){
      queryPostListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:49294_1
queryPostListReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:49306_1
    }
  
    /*1-3-08查询职位列表[212]   */
    Assert.isNull(queryPostListReq.getSubjectLifeCycle(),"D1-3查询职位列表（边界）-1-3-08查询职位列表-主体生命周期不能为空",false);
Assert.isNull(queryPostListReq.getSpaceId(),"D1-3查询职位列表（边界）-1-3-08查询职位列表-创建于空间ID不能为空",false);
      listPost = mPostService.queryPostList(queryPostListReq);
      
      
      listPost_1 = listPost;
    
QueryPostListBorderRespDto retData = new QueryPostListBorderRespDto();
  retData.setPostList(listPost_1.stream().map(item -> BeanUtil.toBean(item, PostDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:49307_1
  

  
  
return retData;
  }

    /**
   * D1-3存档岗位[1660]
   * gen by moon at 10/2/2022, 12:17:52 AM
   */
  @Trace(operationName = "D1-3存档岗位")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public ArchiveStationRespDto archiveStation(ArchiveStationReqDto reqDto){
    
      
      //步骤0: 1-3-10查询目标职责明细列表 - queryTargetDetailsList
     List<DutyTargetDetail> listDutyTargetDetail =new ArrayList<>();
    QueryTargetDetailsListReq queryTargetDetailsListReq=new QueryTargetDetailsListReq();
  queryTargetDetailsListReq.setTypeCode("STATION");//sourceId:49300_1
queryTargetDetailsListReq.setSubjectLifeCycle("EDITING");//sourceId:49303_1
if(reqDto!=null){
      queryTargetDetailsListReq.setEntityId(reqDto.getStationId());//SimpleFieldAssign//sourceId:49301_1
    }
  
    /*1-3-10查询目标职责明细列表（查正在编辑）[181]   */
    Assert.isNull(queryTargetDetailsListReq.getTypeCode(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查正在编辑）-所属对象实例类型不能为空",false);
Assert.isNull(queryTargetDetailsListReq.getEntityId(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查正在编辑）-所属对象实例ID不能为空",false);
Assert.isNull(queryTargetDetailsListReq.getSubjectLifeCycle(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查正在编辑）-主体生命周期不能为空",false);
      listDutyTargetDetail = mDutyTargetDetailService.queryTargetDetailsList(queryTargetDetailsListReq);
      
      
      
    
//步骤1: 1-3-10批量删除目标职责明细 - batchDeleteTargetDetail
     boolean bOOLEAN ;
    if(listDutyTargetDetail !=null&& listDutyTargetDetail.size()>0 ){
          List<String> listString=new ArrayList<>();
  listString = listDutyTargetDetail.stream().map(item->item.getDutyTargetDetailId())
        .collect(Collectors.toList());/*list-to-strings*///sourceId:49311_1
  
    /*1-3-10批量删除目标职责明细[942]   */
    
      bOOLEAN = mDutyTargetDetailService.batchDeleteTargetDetail(listString);
      
      
      
           }
    
//步骤2: 1-3-10查询目标职责明细列表 - queryTargetDetailsList
     List<DutyTargetDetail> listDutyTargetDetail_2 =new ArrayList<>();
    QueryTargetDetailsListReq queryTargetDetailsListReq_1=new QueryTargetDetailsListReq();
  queryTargetDetailsListReq_1.setTypeCode("STATION");//sourceId:49313_1
queryTargetDetailsListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49316_1
if(reqDto!=null){
      queryTargetDetailsListReq_1.setEntityId(reqDto.getStationId());//SimpleFieldAssign//sourceId:49314_1
    }
  
    /*1-3-10查询目标职责明细列表（查当前有效）[181]   */
    Assert.isNull(queryTargetDetailsListReq_1.getTypeCode(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查当前有效）-所属对象实例类型不能为空",false);
Assert.isNull(queryTargetDetailsListReq_1.getEntityId(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查当前有效）-所属对象实例ID不能为空",false);
Assert.isNull(queryTargetDetailsListReq_1.getSubjectLifeCycle(),"D1-3存档岗位-1-3-10查询目标职责明细列表（查当前有效）-主体生命周期不能为空",false);
      listDutyTargetDetail_2 = mDutyTargetDetailService.queryTargetDetailsList(queryTargetDetailsListReq_1);
      
      
      
    
//步骤3: 1-3-10批量修改目标职责明细 - batchUpdateTargetDetail
     boolean bOOLEAN_1 ;
    if(listDutyTargetDetail_2 !=null&& listDutyTargetDetail_2.size()>0 ){
          List<DutyTargetDetail> listDutyTargetDetail_4=new ArrayList<>();
  listDutyTargetDetail_4 = listDutyTargetDetail_2.stream().map(item -> BeanUtil.toBean(item, DutyTargetDetail.class)).collect(Collectors.toList());//objList-to-objLists//sourceId:49326_1
//listDutyTargetDetail_4.setIsArchive("TRUE");//sourceId:49331_1
//listDutyTargetDetail_4.setSubjectLifeCycle("ARCHIVING");//sourceId:49339_1
  
    /*1-3-10批量修改目标职责明细（存档）[933]   */
    Assert.isNull(listDutyTargetDetail_4,"D1-3存档岗位-1-3-10批量修改目标职责明细（存档）-是否存档不能为空",false);
Assert.isNull(listDutyTargetDetail_4,"D1-3存档岗位-1-3-10批量修改目标职责明细（存档）-主体生命周期不能为空",false);
      bOOLEAN_1 = mDutyTargetDetailService.batchUpdateTargetDetail(listDutyTargetDetail_4);
      
      
      
           }
    
//步骤4: 1-3-07修改岗位 - updateStation
     boolean bOOLEAN_2 ;
    Station station=new Station();
  station.setSubjectLifeCycle("ARCHIVING");//sourceId:49351_1
station.setIsArchive("TRUE");//sourceId:49352_1
if(reqDto!=null){
      station.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:49344_1
    }
  
    /*1-3-07修改岗位（存档）[205]   */
    Assert.isNull(station.getStationId(),"D1-3存档岗位-1-3-07修改岗位（存档）-岗位ID不能为空",false);
Assert.isNull(station.getSubjectLifeCycle(),"D1-3存档岗位-1-3-07修改岗位（存档）-主体生命周期不能为空",false);
Assert.isNull(station.getIsArchive(),"D1-3存档岗位-1-3-07修改岗位（存档）-是否存档不能为空",false);
      bOOLEAN_2 = mStationService.updateStation(station);
      
      
      
    
ArchiveStationRespDto retData = new ArchiveStationRespDto();
  
  

  
  
return retData;
  }

    /**
   * D1-3修改岗位[1642]
   * gen by moon at 10/2/2022, 12:17:15 AM
   */
  @Trace(operationName = "D1-3修改岗位")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public UpdateStationRespDto updateStation(UpdateStationReqDto reqDto){
    
      
      //步骤0: 1-3-07修改岗位 - updateStation
     boolean bOOLEAN ;
    Station station=new Station();
  if(reqDto!=null){
      station.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:47806_1
station.setStationTypeId(reqDto.getStationTypeId());//SimpleFieldAssign//sourceId:47807_1
station.setPostId(reqDto.getPostId());//SimpleFieldAssign//sourceId:47808_1
station.setStationNumber(reqDto.getStationNumber());//SimpleFieldAssign//sourceId:47809_1
station.setStationName(reqDto.getStationName());//SimpleFieldAssign//sourceId:47810_1
station.setStationDutyDesc(reqDto.getStationDutyDesc());//SimpleFieldAssign//sourceId:47811_1
station.setStationTargetDesc(reqDto.getStationTargetDesc());//SimpleFieldAssign//sourceId:47812_1
station.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47813_1
    }
  
    /*1-3-07修改岗位[205]   */
    Assert.isNull(station.getStationId(),"D1-3修改岗位-1-3-07修改岗位-岗位ID不能为空",false);
      bOOLEAN = mStationService.updateStation(station);
      
      
      
    
UpdateStationRespDto retData = new UpdateStationRespDto();
  
  

  
  
return retData;
  }

    /**
   * D1-3新增岗位[1639]
   * gen by moon at 10/2/2022, 12:17:04 AM
   */
  @Trace(operationName = "D1-3新增岗位")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public AddStationRespDto addStation(AddStationReqDto reqDto){
    
      
      String string_1 =null;
//步骤0: 1-3-07新增岗位 - addStation
     String string = null;
    Station station=new Station();
  if(reqDto!=null){
      station.setStationTypeId(reqDto.getStationTypeId());//SimpleFieldAssign//sourceId:47707_1
station.setPostId(reqDto.getPostId());//SimpleFieldAssign//sourceId:47708_1
station.setStationNumber(reqDto.getStationNumber());//SimpleFieldAssign//sourceId:47709_1
station.setStationName(reqDto.getStationName());//SimpleFieldAssign//sourceId:47710_1
station.setStationDutyDesc(reqDto.getStationDutyDesc());//SimpleFieldAssign//sourceId:47711_1
station.setStationTargetDesc(reqDto.getStationTargetDesc());//SimpleFieldAssign//sourceId:47712_1
station.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47713_1
    }
  
    /*1-3-07新增岗位[204]   */
    Assert.isNull(station.getStationTypeId(),"D1-3新增岗位-1-3-07新增岗位-岗位类型ID不能为空",false);
Assert.isNull(station.getStationNumber(),"D1-3新增岗位-1-3-07新增岗位-岗位编号不能为空",false);
Assert.isNull(station.getStationName(),"D1-3新增岗位-1-3-07新增岗位-岗位名称不能为空",false);
Assert.isNull(station.getSubjectLifeCycle(),"D1-3新增岗位-1-3-07新增岗位-主体生命周期不能为空",false);
      string = mStationService.addStation(station);
      
      
      string_1 = string;
    
AddStationRespDto retData = new AddStationRespDto();
  if(string_1!=null){
      retData.setStationId(string_1);//SimpleFieldAssign//sourceId:47720_1
    }
  

  
  
return retData;
  }

    /**
   * D1-3修改职位[1636]
   * gen by moon at 10/2/2022, 12:16:52 AM
   */
  @Trace(operationName = "D1-3修改职位")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public UpdatePostRespDto updatePost(UpdatePostReqDto reqDto){
    
      
      //步骤0: 1-3-08修改职位 - updatePost
     boolean bOOLEAN ;
    Post post=new Post();
  if(reqDto!=null){
      post.setPostId(reqDto.getPostId());//SimpleFieldAssign//sourceId:47544_1
post.setPostNumber(reqDto.getPostNumber());//SimpleFieldAssign//sourceId:47545_1
post.setPostName(reqDto.getPostName());//SimpleFieldAssign//sourceId:47546_1
post.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47547_1
    }
  
    /*1-3-08修改职位[210]   */
    Assert.isNull(post.getPostId(),"D1-3修改职位-1-3-08修改职位-职位ID不能为空",false);
      bOOLEAN = mPostService.updatePost(post);
      
      
      
    
UpdatePostRespDto retData = new UpdatePostRespDto();
  
  

  
  
return retData;
  }

    /**
   * D1-3新增职位[1635]
   * gen by moon at 10/2/2022, 12:16:40 AM
   */
  @Trace(operationName = "D1-3新增职位")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public AddPostRespDto addPost(AddPostReqDto reqDto){
    
      
      String string_1 =null;
//步骤0: 1-3-08新增职位 - addPost
     String string = null;
    Post post=new Post();
  if(reqDto!=null){
      post.setPostNumber(reqDto.getPostNumber());//SimpleFieldAssign//sourceId:47512_1
post.setPostName(reqDto.getPostName());//SimpleFieldAssign//sourceId:47513_1
post.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47514_1
    }
  
    /*1-3-08新增职位[209]   */
    Assert.isNull(post.getPostNumber(),"D1-3新增职位-1-3-08新增职位-职位编号不能为空",false);
Assert.isNull(post.getPostName(),"D1-3新增职位-1-3-08新增职位-职位名称不能为空",false);
Assert.isNull(post.getSubjectLifeCycle(),"D1-3新增职位-1-3-08新增职位-主体生命周期不能为空",false);
      string = mPostService.addPost(post);
      
      
      string_1 = string;
    
AddPostRespDto retData = new AddPostRespDto();
  if(string_1!=null){
      retData.setPostId(string_1);//SimpleFieldAssign//sourceId:47518_1
    }
  

  
  
return retData;
  }

    /**
   * D1-3查询职位列表[957]
   * gen by moon at 10/2/2022, 7:52:20 AM
   */
  @Trace(operationName = "D1-3查询职位列表")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryPostListRespDto queryPostList(QueryPostListReqDto reqDto){
    
      
      List<Post> listPost_1 =new ArrayList<>();
//步骤0: 1-3-08查询职位列表 - queryPostList
     List<Post> listPost =new ArrayList<>();
    QueryPostListReq queryPostListReq=new QueryPostListReq();
  if(reqDto!=null){
      queryPostListReq.setPostNumber(reqDto.getPostNumber());//SimpleFieldAssign//sourceId:47561_1
queryPostListReq.setPostName(reqDto.getPostName());//SimpleFieldAssign//sourceId:47562_1
queryPostListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47563_1
queryPostListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:47566_1
queryPostListReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:49065_1
    }
  
    /*1-3-08查询职位列表[212]   */
    
      listPost = mPostService.queryPostList(queryPostListReq);
      
      
      listPost_1 = listPost;
    
QueryPostListRespDto retData = new QueryPostListRespDto();
  retData.setPostList(listPost_1.stream().map(item -> BeanUtil.toBean(item, PostDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47571_1
  

  
  
return retData;
  }

    /**
   * D1-3查询岗位详情[956]
   * gen by moon at 10/2/2022, 7:52:08 AM
   */
  @Trace(operationName = "D1-3查询岗位详情")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public QueryStationDetailRespDto queryStationDetail(QueryStationDetailReqDto reqDto){
    
      
      Station station_1 =null;
Post post_1 =null;
StationType stationType_1 =null;
//步骤0: 1-3-07查询岗位详情 - queryStationDetail
     Station station = null;
    QueryStationDetailReq queryStationDetailReq=new QueryStationDetailReq();
  if(reqDto!=null){
      queryStationDetailReq.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:19468_1
    }
  
    /*1-3-07查询岗位详情[208]   */
    Assert.isNull(queryStationDetailReq.getStationId(),"D1-3查询岗位详情-1-3-07查询岗位详情-岗位ID不能为空",false);
      station = mStationService.queryStationDetail(queryStationDetailReq);
      
      
      station_1 = station;
    
//步骤1: 1-3-08查询职位详情 - queryPostDetail
     Post post = null;
    if(station !=null){
          QueryPostDetailReq queryPostDetailReq=new QueryPostDetailReq();
  if(station!=null){
      queryPostDetailReq.setPostId(station.getPostId());//SimpleFieldAssign//sourceId:19633_1
    }
  
    /*1-3-08查询职位详情[213] 入参职位ID,查询职位名称  */
    
      post = mPostService.queryPostDetail(queryPostDetailReq);
      
      
      post_1 = post;
           }
    
//步骤2: 1-3-04查询岗位类型详情 - queryStationTypeDetail
     StationType stationType = null;
    if(station !=null){
          QueryStationTypeDetailReq queryStationTypeDetailReq=new QueryStationTypeDetailReq();
  if(station!=null){
      queryStationTypeDetailReq.setStationTypeId(station.getStationTypeId());//SimpleFieldAssign//sourceId:48004_1
    }
  
    /*1-3-04查询岗位类型详情[141]   */
    
      stationType = mStationTypeService.queryStationTypeDetail(queryStationTypeDetailReq);
      
      
      stationType_1 = stationType;
           }
    
QueryStationDetailRespDto retData = new QueryStationDetailRespDto();
  if(station_1!=null){
      retData.setStationId(station_1.getStationId());//SimpleFieldAssign//sourceId:19581_1
retData.setStationNumber(station_1.getStationNumber());//SimpleFieldAssign//sourceId:19584_1
retData.setStationName(station_1.getStationName());//SimpleFieldAssign//sourceId:19585_1
retData.setStationDutyDesc(station_1.getStationDutyDesc());//SimpleFieldAssign//sourceId:19586_1
retData.setStationTargetDesc(station_1.getStationTargetDesc());//SimpleFieldAssign//sourceId:19587_1
retData.setOperationInductionId(station_1.getOperationInductionId());//SimpleFieldAssign//sourceId:19588_1
retData.setOperateTime(station_1.getOperateTime());//SimpleFieldAssign//sourceId:19589_1
retData.setPostId(station_1.getPostId());//SimpleFieldAssign//sourceId:47940_1
retData.setStationTypeId(station_1.getStationTypeId());//SimpleFieldAssign//sourceId:19582_1
retData.setSubjectLifeCycle(station_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:53906_1
    }
if(post_1!=null){
      retData.setPostName(post_1.getPostName());//SimpleFieldAssign//sourceId:19657_1
    }
if(stationType_1!=null){
      retData.setStationTypeName(stationType_1.getStationTypeName());//SimpleFieldAssign//sourceId:48067_1
    }
  

  
  
return retData;
  }
    //
}
